<% if params[:act] %>
    <% if params[:act] == "add_customer" %>
        <script type="text/javascript">
          $(function() {
            $('#add_customer_dialog').dialog({ autoOpen: false});
            $('#add_customer_dialog').dialog('open');
            });
        </script>
        <div id="add_customer_dialog" title="Adding a Customer&nbsp;">
          <%= render(:partial => "customer/add_customer") %>
        </div>
    <% end %>
<% end %>

<div style="border: solid 1px red; padding: 20px">

<h3>Select Customer</h3>

<hr>

<span class ="right"><%= link_to "Add Customer", {:action => 'customer', :act => "add_customer"}, {:method => :post} %></span>
<% form_tag :controller => 'rental', :action => 'customer', :method => 'get' do %>
      <%= text_field_tag :search, params[:search], :id => 'search_field' %>
      <%= submit_tag "Search", :name => nil %>
      <%= link_to_function "Clear", "$('search_field').clear()" %>
<% end %>

<table id="customer_table" class="tablesorter">
<thead>
    <tr>
      <th>Student ID</th>
      <th>Name</th>
      <th>Select</th>
    </tr>
</thead>
<tbody id="tablecontent" style="overflow:scroll;">
<% @customer.each do |eE| %>
    <tr>
        <td>
            <%= eE.studentid %>
        </td>
        <td>
            <%= eE.first_name %> <%= eE.last_name %>
        </td>
        <td>
            <%= link_to "Select Customer", {:action => "blaze_custmr", :id => eE.id} %>
        </td>
    </tr>
<% end %>
</tbody>
</table>
</div>

<script type="text/javascript">
    $("#customer_table").tablesorter();
    $('#tablecontent').css('height', $(window).height() - 300 + 'px');
    var temp = $('#tablecontent').width();
    $('#tablecontent').css('width', '200px');
</script>

